package com.wty.gw.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wty.gw.util.PageParamReq;
import com.wty.gw.dao.ProductMapper;
import com.wty.gw.model.Do.ProductDO;
import com.wty.gw.model.query.ProductQuery;
import com.wty.gw.service.ProductService;
import com.wty.gw.model.vo.ProductVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ProductServiceImpl implements ProductService{

	@Autowired
    private ProductMapper productMapper;

    @Override
    public void add(ProductDO productDo) {
        productMapper.insert(productDo);
    }

    @Override
    public void delete(Long id) {
        productMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(ProductDO productDo) {
        productMapper.updateByPrimaryKeySelective(productDo);
    }

    @Override
    public PageInfo<ProductVo> listByPage(ProductQuery productQuery) {
        PageHelper.startPage(productQuery.getPageNo(), productQuery.getPageSize());

        return new PageInfo(productMapper.listBycompanyId(productQuery));
    }

    @Override
    public ProductDO get(Long id) {
        return productMapper.selectByPrimaryKey(id);
    }
	
	
	
	
	
	
}